#include <bit>
#include <iostream>
#include <cstdint>
//g++ 3.cpp --std=c++23
int main() {
    uint32_t num = 0x12345678;  // 假设这是需要发送的数据
    std::cout << "原始数据: 0x" << std::hex << num << std::endl;

    // 转换字节序以适应大端接收
    uint32_t swapped = std::byteswap(num);
    std::cout << "转换后的数据: 0x" << std::hex << swapped << std::endl;

    // 假设这是在接收方
    uint32_t received = std::byteswap(swapped);
    std::cout << "接收后的数据（转回原始字节序）: 0x" << std::hex << received << std::endl;
    
    return 0;
}